//---------------------------------------------------------------------------
function UserList(idMembers, idAvailables)
{
	this.move = function(idSrc, idDst)
	{
		var i;
		var s = $(idSrc), d = $(idDst);
		for (i = s.options.length - 1; i >= 0; i--)
			if (s.options[i].selected) {
				s.options[i].selected = false;
				d.options[d.options.length] = new Option(s.options[i].text, s.options[i].value);
				s.options[i] = null;
			}
	}

	this.join = function()
	{
		this.move(this.a, this.m);
	}

	this.part = function()
	{
		this.move(this.m, this.a);
	}

	this.m = idMembers;
	this.a = idAvailables;

	return this;
}
//---------------------------------------------------------------------------
function MemberList(id)
{
	this.handler = $(id);

	this.choose = function(value)
	{
		var list = this.handler;
		for (var i = 0; i < list.options.length; i++)
			if (list.options[i].value == value) {
				list.selectedIndex = i;
				return;
			}
	}

	this.select = function(value)
	{
		var list = this.handler;
		for (var i = 0; i < list.options.length; i++)
			if (list.options[i].value == value) {
				list.options[i].selected = true;
				return;
			}
	}

	this.selectAll = function()
	{
		var list = this.handler;
		for (var i = 0; i < list.options.length; i++)
			list.options[i].selected = true;
	}

	return this;
}
//---------------------------------------------------------------------------
